<?php echo $this->fetch('header.html'); ?>
<script language="javascript" src="/plugin/jquery/ajaxfileupload.js"></script>
<script language="javascript">
   function uploadgoodsimg()
    {
        //starting setting some animation when the ajax starts and completes
        $("#loading")
        .ajaxStart(function(){
            $(this).show();
        })
        .ajaxComplete(function(){
            $(this).hide();
        });

        $.ajaxFileUpload
        (
            {
                url:'/index.php?m=upload&a=upload&t='+Math.random(), 
                secureuri:false,
                fileElementId:'upimg',
                dataType: 'json',
                success: function (data, status)
                {
                    if(typeof(data.error) != 'undefined')
                    {
                        if(data.error != '')
                        {
                           alert(data.msg);
                        }else
                        {
                             $("#imgShow").html("<img src='/"+data.imgurl+"' width='50'>");
							 $("#imgurl").val(data.imgurl);
                        }
                    }
                },
                error: function (data, status, e)
                {
					alert(data.msg)
  
                }
            }
        )
        
        return false;

    }
</script>
<ul class="nav nav-tabs">
<li><a href="<?php echo $this->_var['appadmin']; ?>?m=navbar"><?php echo $this->_var['lang']['navbar_admin']; ?></a></li> 
<li class="active"><a href="<?php echo $this->_var['appadmin']; ?>?m=navbar&a=add"><?php echo $this->_var['lang']['navbar_add']; ?></a></li>
</ul>

<div class="rbox">
<form action="admin.php?m=navbar&a=save" method="post">
<input type="hidden" name="id" value="<?php echo $this->_var['nav']['id']; ?>">
<table width="100%" border="0" cellspacing="1" cellpadding="0" class="table table-bordered">


 <?php if (! $this->_var['parent']): ?>		
  <tr>
    <td height="30" align="right"><?php echo $this->_var['lang']['target']; ?>：</td>
    <td><select name="target" id="target">
      <option value="_self"><?php echo $this->_var['lang']['_self']; ?></option>
      <option value="_blnk" <?php if ($this->_var['nav']['target'] == '_blank'): ?> selected="selected"<?php endif; ?>><?php echo $this->_var['lang']['_blank']; ?></option>
    </select></td>
  </tr>
  <?php endif; ?>
  <?php if ($this->_var['parent']): ?>	
  <tr>
    <td width="16%" height="30" align="right"><?php echo $this->_var['lang']['last_category']; ?>：</td>
    <td width="84%">
    <input type="hidden" name="pid" value="<?php echo $this->_var['parent']['id']; ?>">
      <?php echo $this->_var['parent']['title']; ?></td>
  </tr>
  <?php endif; ?>
  <tr>
    <td height="30" align="right"><?php echo $this->_var['lang']['name']; ?>：</td>
    <td><input name="title" type="text" value="<?php echo $this->_var['nav']['title']; ?>" />

  </tr>
  <tr>
    <td height="30" align="right"><?php echo $this->_var['lang']['link_url']; ?>：</td>
    <td><input name="link_url" type="text" id="link_url" value="<?php echo $this->_var['nav']['link_url']; ?>" size="40" /></td>
  </tr>
  <?php if (! $this->_var['parent']): ?>
  <tr>
    <td height="30" align="right"><?php echo $this->_var['lang']['position']; ?>：</td>
    <td><select name="group_id" id="group_id">
    	<?php $_from = $this->_var['group_list']; if (!is_array($_from) && !is_object($_from)) { $_from=array();}; $this->push_vars('k', 'g');if (count($_from)):
    foreach ($_from AS $this->_var['k'] => $this->_var['g']):
?>
        <option value="<?php echo $this->_var['k']; ?>" <?php if ($this->_var['k'] == $this->_var['nav']['group_id']): ?> selected<?php endif; ?>><?php echo $this->_var['g']; ?></option>
        <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
    </select></td>
  </tr>
  <?php endif; ?>
  
      <tr>
    <td align="right">图标：</td>
    <td>
    <div class="btn-upload">
      <input type="file" name="upimg" class="btn-upload-file" id="upimg" onChange="uploadgoodsimg()">
      </div>
      <label  id="loading" style="color:red; display:none;">正在上传中...</label>
      <input type="hidden" name="logo" id="imgurl" value="<?php echo $this->_var['nav']['logo']; ?>">
      <span id="imgShow">
      <?php if ($this->_var['nav']['logo']): ?>
      <img src="/<?php echo $this->_var['nav']['logo']; ?>">
      <?php endif; ?>
      </span>
      </td>
  </tr>
  
  <tr>
    <td height="30" align="right">m：      </td>
    <td><input name="m" type="text" id="m" value="<?php echo $this->_var['nav']['m']; ?>" /></td>
  </tr>
  <tr>
    <td height="30" align="right">a：</td>
    <td><input name="a" type="text" id="a" value="<?php echo $this->_var['nav']['a']; ?>" /></td>
  </tr>
  <tr>
    <td height="30" align="right"><?php echo $this->_var['lang']['sort']; ?>：</td>
    <td><input name="orderindex" type="text" id="orderindex" value="<?php echo $this->_var['nav']['orderindex']; ?>" /></td>
  </tr>
  <tr>
    <td height="30" align="right">&nbsp;</td>
    <td><input type="submit" name="button" id="button" value="<?php echo $this->_var['lang']['submit']; ?>" class="btn" /></td>
  </tr>
</table>

</form>
</div>
<?php echo $this->fetch('footer.html'); ?>